// PartRod.h: interface for the PartRod class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PARTROD_H__630C571D_66E0_4A9D_AD2D_A97152777D09__INCLUDED_)
#define AFX_PARTROD_H__630C571D_66E0_4A9D_AD2D_A97152777D09__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PartConnect.h"

class DllExport PartRod : public PartConnect  
{
public:
	PartRod();
	virtual ~PartRod();

public:
	virtual BOOL Accept(ModelVisitor* pVisitor);
public:
	DOUBLE GetHeight(){
		GetVariableValue(_T("SizeH"), m_dbHeight);
		return m_dbHeight;
	}
	DOUBLE GetBottomInsertLength(){
		GetVariableValue(_T("BEGININSERTLENGTH"), m_dbBottomInsertLength);
		return m_dbBottomInsertLength;
	}
	DOUBLE GetTopInsertLength(){
		GetVariableValue(_T("ENDINSERTLENGTH"), m_dbTopInsertLength);
		return m_dbTopInsertLength;
	}

	void SetHeight(DOUBLE dbHeight){
		ChangeStateInSetFunction(m_dbHeight, dbHeight);
		SetVariableValue(_T("SizeH"), dbHeight);
		m_dbHeight = dbHeight;
	}
	void SetBottomInsertLength(DOUBLE dbLen);
	void SetTopInsertLength(DOUBLE dbLen);

	void SetMinLength(DOUBLE dbMinLength);
	DOUBLE GetMinLength(){return m_dbMinLength;}

	void SetWeightPerMeter(DOUBLE dbWeightPerMeter){
		ChangeStateInSetFunction(m_dbWeightPerMeter, dbWeightPerMeter);
		SetVariableValue(_T("Weight"), dbWeightPerMeter);
		m_dbWeightPerMeter = dbWeightPerMeter;}

	DOUBLE GetWeightPerMeter(){
		DOUBLE dbTemp = 0.0;
		if(GetVariableValue(_T("Weight"), dbTemp))
			return dbTemp;
		return m_dbWeightPerMeter;}

	virtual DOUBLE GetUnitWeight(){
		return GetLength()/1000*m_dbWeightPerMeter;
	}
	
	virtual DOUBLE GetLength();
	virtual void SetLength ( DOUBLE dLength );

	void SetBottomScrewThreadLength(DOUBLE dbLength);

	DOUBLE GetBottomScrewThreadLength(){
		GetVariableValue(_T("Size4"), m_dbBottomScrewThreadLength);
		return m_dbBottomScrewThreadLength;
	}

	void SetTopScrewThreadLength(DOUBLE dbLength);

	DOUBLE GetTopScrewThreadLength(){
		GetVariableValue(_T("Size3"), m_dbTopScrewThreadLength);
		return m_dbTopScrewThreadLength;
	}

	virtual void SetMaxInsertLength(DOUBLE dbLength){
		ChangeStateInSetFunction(m_dbMaxInsertLength, dbLength);
		SetVariableValue(_T("size4"), dbLength);
		m_dbMaxInsertLength = dbLength;
	}

	virtual DOUBLE GetMaxInsertLength(){
		DOUBLE dbTemp = 0.0;
		if(GetVariableValue(_T("size4"), dbTemp))
			return dbTemp;
		return m_dbMaxInsertLength;
	}

private:
	DOUBLE m_dbHeight;//rod's height
	DOUBLE m_dbBottomInsertLength;//rod's bottom insert length
	DOUBLE m_dbTopInsertLength;//rod's top insert length
	DOUBLE m_dbUnitWeight;//rod's weight per meter
	DOUBLE m_dbMinLength;//rod's minmum length
	DOUBLE m_dbWeightPerMeter;//rod's weight per meter
	DOUBLE m_dbBottomScrewThreadLength;
	DOUBLE m_dbTopScrewThreadLength;
};

#endif // !defined(AFX_PARTROD_H__630C571D_66E0_4A9D_AD2D_A97152777D09__INCLUDED_)
